{"ast":null,"code":"import _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport default function usePatchElement() {\n  var _React$useState = React.useState([]),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    elements = _React$useState2[0],\n    setElements = _React$useState2[1];\n  var patchElement = React.useCallback(function (element) {\n    // append a new element to elements (and create a new ref)\n    setElements(function (originElements) {\n      return [].concat(_toConsumableArray(originElements), [element]);\n    });\n    // return a function that removes the new element out of elements (and create a new ref)\n    // it works a little like useEffect\n    return function () {\n      setElements(function (originElements) {\n        return originElements.filter(function (ele) {\n          return ele !== element;\n        });\n      });\n    };\n  }, []);\n  return [elements, patchElement];\n}","map":{"version":3,"names":["_toConsumableArray","React","usePatchElement","useState","elements","setElements","patchElement","useCallback","element","originElements","concat","filter","ele"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/_util/hooks/usePatchElement.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nexport default function usePatchElement() {\n  const [elements, setElements] = React.useState([]);\n  const patchElement = React.useCallback(element => {\n    // append a new element to elements (and create a new ref)\n    setElements(originElements => [].concat(_toConsumableArray(originElements), [element]));\n    // return a function that removes the new element out of elements (and create a new ref)\n    // it works a little like useEffect\n    return () => {\n      setElements(originElements => originElements.filter(ele => ele !== element));\n    };\n  }, []);\n  return [elements, patchElement];\n}"],"mappings":";AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,eAAe,SAASC,eAAe,GAAG;EACxC,sBAAgCD,KAAK,CAACE,QAAQ,CAAC,EAAE,CAAC;IAAA;IAA3CC,QAAQ;IAAEC,WAAW;EAC5B,IAAMC,YAAY,GAAGL,KAAK,CAACM,WAAW,CAAC,UAAAC,OAAO,EAAI;IAChD;IACAH,WAAW,CAAC,UAAAI,cAAc;MAAA,OAAI,EAAE,CAACC,MAAM,CAACV,kBAAkB,CAACS,cAAc,CAAC,EAAE,CAACD,OAAO,CAAC,CAAC;IAAA,EAAC;IACvF;IACA;IACA,OAAO,YAAM;MACXH,WAAW,CAAC,UAAAI,cAAc;QAAA,OAAIA,cAAc,CAACE,MAAM,CAAC,UAAAC,GAAG;UAAA,OAAIA,GAAG,KAAKJ,OAAO;QAAA,EAAC;MAAA,EAAC;IAC9E,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,CAACJ,QAAQ,EAAEE,YAAY,CAAC;AACjC"},"metadata":{},"sourceType":"module"}